//WY6 合唱团
import java.util.;

注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
   public static void main(String[] args) {
       Scanner in = new Scanner(System.in);
       int n = in.nextInt();
       long[] arr = new long[n];
       for (int i = 0; i  n; i++) {
           arr[i] = in.nextLong();
       }
       int k = in.nextInt();
       int d = in.nextInt();
       long[][] dp1 = new long[k + 1][n + 1];最大
       long[][] dp2 = new long[k + 1][n + 1];最小
       for (int i = 0; i = n; i++) {
           dp1[0][i] = 1;
           dp2[0][i] = 1;
       }
       for (int i = 0; i = k; i++) {
           dp1[i][0] = 1;
           dp2[i][0] = 1;
       }
       for (int i = 1; i = k; i++) {
           for (int j = 1; j = n; j++) {
               dp1[i][j] = arr[j - 1];
               dp2[i][j] = arr[j - 1];

               if (arr[j - 1]  0) {
                   for (int m = 1; m = d; m++) {
                       if (j - m  0) {
                           break;
                       }
                       dp1[i][j] = Math.max(arr[j - 1]dp2[i-1][j-m], dp1[i][j]);
                       dp2[i][j] = Math.min(arr[j - 1]dp1[i-1][j-m], dp2[i][j]);
                   }
               } else {
                   for (int m = 1; m = d; m++) {
                       if (j - m  0) {
                           break;
                       }
                       dp1[i][j] = Math.max(arr[j - 1]dp1[i-1][j-m], dp1[i][j]);
                       dp2[i][j] = Math.min(arr[j - 1]dp2[i-1][j-m], dp2[i][j]);
                   }
               }
           }
       }
       long max = 0;
       for (int i = 0; i = n; i++) {
           max = Math.max(max, dp1[k][i]);
       }
       System.out.println(max);
   }
}

